<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false"%>

<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/3/21
  Time: 15:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%--  BootStrap--%>
<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<html>
<head>
    <title>增加销售额</title>
    <script src="${pageContext.request.contextPath}/js/jquery-3.6.0.js" charset="UTF-8"></script>
    <script charset="UTF-8">
  function a() {
    $.post({
         url:"${pageContext.request.contextPath}/a1",
         data:{"name":$("#productname").val()},
        success:function (data) {

        $("#userInfo").css("color","red");
        $("#userInfo").html(data);
        }
    })
  }

    </script>
</head>
<body style="background-color:#e7e7e7 ">
<div class="container" style="background-color: #e7e7e7">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>新增销售</small>
                </h1>
            </div>
        </div>
        <div>
            <form action="${pageContext.request.contextPath}/sale/addsale" method="post">
<%--                <div class="form-group">--%>
<%--                    <label for="bkname">商品编号</label>--%>
<%--                    <input type="text" name="id" class="form-control" id="bkname" required>--%>
<%--                </div>--%>

<%--    <label for="bkname1">商品名称</label>--%>
<%--    <select name="" id=""  >--%>
<%--        <c:forEach var="product" items="${product}">--%>
<%--            <option value="${product.name}">${product.name}--%>

<%--            </option>--%>
<%--        </c:forEach>--%>
<%--    </select>--%>
    <div class="form-group">
        <label for="bkname1">商品名称</label>
        <select id="productname" name="name" id="bkname1" onblur="a()">
            <c:forEach var="product" items="${product}">
                <option value="${product.name}">${product.name}

                </option>
            </c:forEach>
        </select>
    </div>

<%--                <div class="form-group">--%>
<%--                    <label for="bkname1">商品名称</label>--%>
<%--                    <input type="text" name="name" class="form-control" id="bkname1" required>--%>
<%--                </div>--%>
<%--                <div class="form-group">--%>
<%--                    <label for="bkname2">价格</label>--%>
<%--                    <input type="text" name="price" value="" class="form-control" id="bkname2" required>--%>
<%--                </div>--%>
                <div class="form-group">
                    <label for="bkname3">商品数量</label>
<%--                    <span>该商品库存内还有：</span>--%>
                    <span id="userInfo"></span>
<%--                    <span></span>--%>
                    <c:if test="${sessionScope.msgadd!=null}">
                        <span><%=session.getAttribute("msgadd")%></span>
                    </c:if>

                    <input type="text" name="number" class="form-control" id="bkname3" required>
                </div>
                <div class="form-group">
                    <label for="bkname9">时间</label>
                    <input type="text" name="date" class="form-control" id="bkname9" required>
                </div>
<%--                <div class="form-group">--%>
<%--                    <label for="bkname4">顾客联系电话</label>--%>
<%--                    <input type="text" name="tellpone" class="form-control" id="bkname4" required>--%>
<%--                </div>--%>
<%--                <div class="form-group">--%>
<%--                    <label for="bkname8">供货商</label>--%>
<%--                    <input type="text" name="sump" class="form-control"  id="bkname8" required>--%>
<%--                </div>--%>

                <div class="form-group">
                    <label for="bkname7">备注</label>
                    <input type="text" name="detail" class="form-control" id="bkname7" required>
                </div>
                <div class="form-group">
                    <input type="submit" class="form-control" value="添加">
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>
